﻿<link href="~/css/table.css" rel="stylesheet" />
<script src="~/js/jquery-1.11.1.js"></script>
<script src="~/js/vue.js"></script>
<div id="app">
    <form>
        <table width="100%">
            <tr>
                <td>
                    <font color="black">
                        您正在做的业务是：人力资源--客户化设置--人力资源档案管理设置--II级机构设置
                    </font>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <input type="button" onclick="window.location.href='/client/third_kind_register'" value="添加" class="BUTTON_STYLE1" />
                </td>
            </tr>
        </table>
        <table width="100%" border="1" cellpadding=0 cellspacing=1
               bordercolorlight=#848284 bordercolordark=#eeeeee
               class="TABLE_STYLE1">
            <tr>
                <td width="14%" class="TD_STYLE1">
                    I级机构名称
                </td>
                <td width="14%" class="TD_STYLE1">
                    II级机构名称
                </td>
                <td width="14%" class="TD_STYLE1">
                    II级机构编号
                </td>
                <td width="14%" class="TD_STYLE1">
                    III级机构名称
                </td>
                <td width="17%" class="TD_STYLE1">
                    销售责任人编号
                </td>
                <td width="17%" class="TD_STYLE1">
                    是否为零售店
                </td>
                <td width="5%" class="TD_STYLE1">
                    变更
                </td>
                <td width="5%" class="TD_STYLE1">
                    删除
                </td>
            </tr>

            <tr v-for="(item,index) in dt" :key="index">
                <td class="TD_STYLE2">
                    {{item.first_kind_name}}
                </td>
                <td class="TD_STYLE2">
                    {{item.second_kind_name}}
                </td>
                <td class="TD_STYLE2">
                    {{item.second_kind_id}}
                </td>
                <td class="TD_STYLE2">
                    {{item.third_kind_name}}
                </td>
                <td class="TD_STYLE2">
                    {{item.third_kind_sale_id}}
                </td>
                <td class="TD_STYLE2">
                    {{item.third_kind_is_retail}}
                </td>
                <td class="TD_STYLE2">
                    <a :href="'/client/third_kind_change/'+[item.ftk_id]">变更</a>
                </td>
                <td class="TD_STYLE2">
                    <a v-on:click="del([item.ftk_id])">删除</a>
                </td>
            </tr>
        </table>
    </form>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            dt: []
        },
        methods: {
            load: function () {
                var t = this;
                $.ajax({
                    url: "/client/third_kinds",
                    type: "Post",
                    success: function (msg) {
                        var dts = eval(msg);
                        t.dt = dts;
                    }
                })
            },
            del: function (id) {
                var t = this;
                if (confirm('确定要删除吗？')) {
                    $.ajax({
                        url: "/client/third_kind_Delete",
                        type: "DELETE",
                        data: "id="+id,
                        success: function (msg) {
                            if (msg > 0) {
                                alert('删除成功!');
                                t.load();
                            }
                        }
                    })
                }
            },
        },
        mounted: function () {
            this.load();
        }
    })
</script>